package it.fuzzylogics.fuzzywidgetsLibrary.client.FuzzyListeners;

import com.google.gwt.user.client.Element;


public class FMouseListener {


    static FClickListenerHandler clickListenerHandler;
    static FMouseDownHandler mouseDownListenerHandler;
    static FMouseEnterHandler mouseEnterListenerHandler;
    static FMouseLeaveHandler mouseLeaveListenerHandler;
    static FMouseUpHandler mouseUpListenerHandler;
    static FMouseWheelHandler mouseWheelListenerHandler;
    static FMouseMoveHandler mouseMoveHandler;


    public static void setMouseEvent(Element e, final FMouseListenerHandler handler) {

        clickListenerHandler = new FClickListenerHandler() {

            public void onClick() {
                handler.onClick();
            }
        };
        mouseDownListenerHandler = new FMouseDownHandler() {

            public void onMouseDown(int x, int y) {
                handler.onMouseDown(x, y);
            }
        };
        mouseEnterListenerHandler = new FMouseEnterHandler() {

            public void onMouseEnter() {
                handler.onMouseEnter();
            }
        };
        mouseLeaveListenerHandler = new FMouseLeaveHandler() {

            public void onMouseLeave() {
                handler.onMouseLeave();
            }
        };
        mouseUpListenerHandler = new FMouseUpHandler() {

            public void onMouseUp(int x, int y) {
                handler.onMouseUp(x, y);
            }
        };
        mouseWheelListenerHandler = new FMouseWheelHandler() {


            public void onMouseWheelUp(int intensity) {
                handler.onMouseWheelUp(intensity);
            }

            public void onMouseWheelDown(int intensity) {
                handler.onMouseWheelDown(intensity);
            }
        };

        mouseMoveHandler = new FMouseMoveHandler() {


            public void onMouseMove(int x, int y) {
                handler.onMouseMove(x, y);
            }
        };

        FClickListener.setClickEvent(e, clickListenerHandler);
        FMouseDownListener.setMouseDownEvent(e, mouseDownListenerHandler);
        FMouseEnterListener.setMouseEnterEvent(e, mouseEnterListenerHandler);
        FMouseLeaveListener.setMouseLeaveEvent(e, mouseLeaveListenerHandler);
        FMouseUpListener.setMouseUpEvent(e, mouseUpListenerHandler);
        FMouseWheelListener.setMouseWheelListener(e, mouseWheelListenerHandler);
        FMouseMoveListener.setMouseMoveEvent(e, mouseMoveHandler);


    }

}
